<!--
  @author heguanghua
  @since 2019/06/12 11:57
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common::jscss"/>
<body>


<div class="layui-fluid">

    <blockquote class="layui-crumb">
        渠道管理>
        <a lay-href="/channel/list.action">渠道管理</a>>
        <a th:href="'/channel/detail.action?channelId='+${obj.channelId}">[[${obj.name}]]</a>>
        <zmn th:text="服务分类">服务分类</zmn>
    </blockquote>

    <div class="layui-card">

        <div th:replace="channel/_tab::tab"></div>

        <fieldset class="layui-elem-field">
            <div th:if="${obj.rank == 2}" class="layui-field-box" style="color: #9F9F9F;">
                此处若未设置，则将继承上级渠道配置；同时：二级渠道的“开通产品&开通区域&订单库存&价格表”均将继承一级渠道配置；修改后会有5分钟缓存
            </div>
        </fieldset>

        <div class="layui-card-body">
            <form method="POST" action="" class="layui-form" lay-filter="zmn-form">

                <input type="hidden" name="channelId" th:value="${obj.channelId}"/>
                <input type="hidden" name="showType" th:value="${showType}"/>

                <div class="layui-tab layui-tab-brief" lay-filter="servCategId">
                    <ul class="layui-tab-title">
                        <li th:each="servCategory,state:${servCategorys}" th:text="${servCategory.value}" th:lay-id="${servCategory.key}" th:class="${state.index == 0 ? 'layui-this' : ''}"/>
                    </ul>
                    <div class="layui-tab-content">
                        <div th:each="servCategory,state:${servCategorys}" th:class="${state.index == 0 ? 'layui-tab-item layui-show' : 'layui-tab-item'}">
                            <div class="layui-card-body">

                                <div class="layui-form-item">
                                    <div class="inline-block" style="float: left">
                                        <div class="zmn-2layer-list">
                                            <div class="list-left" style="text-align: center">
                                                <div class="list-item" th:text="全选"></div>
                                            </div>
                                            <div class="list-right">
                                                <div class="right-box">
                                                    <div class="list-item">
                                                        <input type="checkbox" class="checkAllServ"
                                                               lay-filter="checkAllServ" th:value="${servCategory.key}"
                                                               title="全选">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="inline-block" style="float: left">
                                    <div class="zmn-2layer-list" th:each="oneCateg:${servCategory.children}">
                                        <div class="list-left" style="text-align: center">
                                            <div class="list-item" th:text="${oneCateg.value}"></div>
                                        </div>
                                        <div class="list-right">
                                            <div class="right-box">
                                                <div class="list-item">
                                                    <input type="checkbox" th:class="${'checkAll ' + servCategory.key}"
                                                           lay-filter="checkAll"
                                                           th:value="${servCategory.key + '-' + oneCateg.key}"
                                                           title="全选">
                                                </div>
                                                <div class="list-item" th:each="categ:${oneCateg.children}"
                                                     th:title="${categ.value}">
                                                    <input type="checkbox" lay-filter="checkOne" name="categoryId"
                                                           th:class="${servCategory.key + '-' + oneCateg.key}"
                                                           th:value="|${servCategory.key}-${oneCateg.key}-${categ.key}|"
                                                           th:checked="${#lists.contains(categIds, servCategory.key + '-' + oneCateg.key + '-' + categ.key)}"
                                                           th:title="${categ.value}">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>


                                <div class="layui-form-item">
                                    <div class="layui-split">&nbsp;</div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-split">&nbsp;</div>
                                </div>

                                <div class="layui-form-item">
                                    <label style="margin-left: -20px" class="layui-form-label">开通通用产品：</label>
                                    <div class="layui-input-inline" style="width:80px;" id="isButton">
                                        <input th:id="${servCategory.key+'enableGeneralProduct'}" th:checked="${switchMap[servCategory.key] == null || switchMap[servCategory.key]}" th:value="${switchMap[servCategory.key]} ? 2:1" type="checkbox" name="open" lay-skin="switch" lay-filter="enableGeneralProduct" lay-text="ON|OFF">
                                    </div>
                                    <div class="layui-input-inline" style="width:530px;">
                                        <label class="layui-form-mid" style="color: #9F9F9F;">指：开通分类后，默认开通该分类下所有通用产品，若：不需开通通用产品，可关闭</label>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item submit">
                    <div class="layui-input-block" style="margin-left: 139px" th:if="${#authPermit.checkPermit('/channel/serviceCategory/addEdit.action') || (#authPermit.checkPermit('/channel/add.action') && addFlag == '1')}">
                        <button class="layui-btn" lay-submit="" lay-filter="zmn-form-submit">提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>

        </div>

    </div>

</div>
</body>
</html>

<script type="text/javascript" th:inline="javascript">

    var json = {
        addFlag: [[${addFlag}]],
        currentServCategId: [[${currentServCategId}]]
    };

    layui.config({
        base: "/static/lay/",
        version: 20200323
    }).extend({
        index: "lib/index",
        channel_serv_category: "channel/zmn.plat.channel.serv.category",
    }).use(['index', 'channel_serv_category']);

</script>
